<template>
  <el-dialog :title="title" :visible.sync="dialogFormVisible">
    <el-form ref="userInfo" :model="form">
      <el-form-item label="用户名称" :label-width="formLabelWidth" prop="name">
        <el-input v-model="form.name" autocomplete="off" clearable />
      </el-form-item>
      <el-form-item label="用户账号" :label-width="formLabelWidth" prop="user_name">
        <el-input v-model="form.user_name" autocomplete="off" clearable />
      </el-form-item>
      <el-form-item label="品牌" :label-width="formLabelWidth" prop="user_name">
        <brand-sel :can-clear="true" @changeVal="changeVal" />
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="dialogFormVisible = false">取 消</el-button>
      <el-button type="primary" @click="submit">确 定</el-button>
    </div>
  </el-dialog>

</template>

<script>
import brandSel from '@/components/BrandSelect'
export default {
  components: {
    brandSel
  },
  data() {
    return {
      dialogFormVisible: false,
      form: {
        name: '',
        user_name: '',
        brand_id: ''
      },
      formLabelWidth: '120px',
      title: '检索'
    }
  },
  methods: {
    submit() {
      this.$emit('searchFun', this.form)
      this.dialogFormVisible = false
    },
    changeVal(val) {
      this.form.brand_id = val
    }
  }

}
</script>

<style lang="sass" scoped>

</style>
